package leetcode.code0101;

import leetcode.helper.tree.TreeNode;

public class Solution extends Solution101 {

	@Override
	public boolean isSymmetric(TreeNode root) {
		return this.isSymmetric(root.left, root.right);
	}

	private boolean isSymmetric(TreeNode left, TreeNode right) {
		if ((left == null && right != null) || (left != null && right == null))
			return false;
		if (left == null && right == null)
			return true;
		if (left.val != right.val)
			return false;
		if (this.isSymmetric(left.left, right.right) && this.isSymmetric(left.right, right.left))
			return true;
		return false;
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
